export  const state ={
    user:sessionStorage.getItem("user")?JSON.parse(sessionStorage.getItem("user")):{}
}

export const mutations = {
    changeUser(state,obj){
        state.user = obj
        if(obj.token){
            sessionStorage.setItem("user",JSON.stringify(obj))
        }else{
            sessionStorage.removeItem("user")
        }
    }
}

export const getters = {
    user(state){
        return state.user
    }
}